// 云函数入口文件
const cloud = require('wx-server-sdk')

const {
  STATUSCODE,
  ModelNameMapper,
  BaseSuccessResponse,
  BaseFailedResponse
} = require('../config.js')


cloud.init()

// 云函数入口函数
exports.main = async (data, context) => {
  const {
    api
  } = data
  const wxContext = cloud.getWXContext()

  const resp = {
    ...BaseSuccessResponse,
    data: {
      openid: wxContext.OPENID,
      appid: wxContext.APPID,
      unionid: wxContext.UNIONID,
    }
  }
  debugger
  return resp
}